import {
    createStore
} from 'vuex'

const store = createStore({
    state: {
        collapsed: false,
        menus: [{
                path: "/",
                redirect: "/home",
                meta: {
                    title: '数据中心',
                    icon: "i-fund-view"
                },
                component: () => import("../views/layouts/BaseLayout"),
                children: [{
                    path: "/home",
                    meta: {
                        title: '可视化显示'
                    },
                    component: () => import("../views/home")
                }]
            },
            {
                path: "/login",
                meta: {
                    title: '登录',
                },
                component: () => import("../views/login/login")
            },
            {
                path: "/news",
                meta: {
                    title: '通知管理',
                    icon: "i-mail"
                },
                children: [{
                        path: "/news/message",
                        meta: {
                            title: '消息通知'
                        },
                        component: () => import("../views/news/message")
                    },
                    {
                        path: "/news/tesk",
                        meta: {
                            title: '教学任务'
                        },
                        component: () => import("../views/news/tesk")
                    }
                ]
            },
            {
                path: "/student",
                meta: {
                    title: '学生管理',
                    icon: "i-user"
                },
                children: [{
                    path: "/student/stuList",
                    meta: {
                        title: '学生列表'
                    },
                    component: () => import("../views/student/stuList")
                }, ]
            },
            {
                path: "/teacher",
                meta: {
                    title: '教师管理',
                    icon: "i-user"
                },
                children: [{
                    path: "/teacher/teacherList",
                    meta: {
                        title: '教师列表'
                    },
                    component: () => import("../views/teacher/teacherList")
                }, ]
            },
            {
                path: "/system",
                meta: {
                    title: '系统设置',
                    icon: "i-setting"
                },
                children: [{
                    path: "/system/class",
                    meta: {
                        title: '班级管理'
                    },
                    component: () => import("../views/system/class")
                }, {
                    path: "/system/department",
                    meta: {
                        title: '部门管理'
                    },
                    component: () => import("../views/system/department")
                }, {
                    path: "/system/menu",
                    meta: {
                        title: '菜单管理'
                    },
                    component: () => import("../views/system/menu")
                }, {
                    path: "/system/role",
                    meta: {
                        title: '角色管理'
                    },
                    component: () => import("../views/system/role")
                }, {
                    path: "/system/online",
                    meta: {
                        title: '在线检测'
                    },
                    component: () => import("../views/system/class")
                }, {
                    path: "/system/dict",
                    meta: {
                        title: '字典'
                    },
                    component: () => import("../views/system/dict")
                }]
            },
        ]
    },
    getters: {
        menus: state => state.menus.filter(r => !r.meta.hideMenu)
    },
    mutations: {
        changeCollapsed(state, collapsed) {
            state.collapsed = !collapsed
        }
    }
})

export default store